package com.github.slprj.slake.net;

/**
 * nio配置
 *
 * @author YangXiaoLong
 * 2022/8/31 15:12
 */
public abstract class NioConfig {
    /**
     * 业务线程数据
     */
    private int bizThreads;
    /**
     * client名字
     */
    private String name;
    // back pressure config
    private int maxOutRequests;
    private int maxInRequests;
    private long maxInBytes;

    /**
     * selector选择时间, 如果时间内没有获取key,则唤醒
     */
    private int selectTimeoutMillis = 50;
    private int cleanIntervalMills = 100;
    private int closeTimeoutMillis = 1000;

    private int maxFrameSize = 8 * 1024 * 1024;


    private int[] bufPoolSize = ByteBufferPool.DEFAULT_BUF_SIZE;
    private int[] bufPoolMinCount = ByteBufferPool.DEFAULT_MIN_COUNT;
    private int[] bufPoolMaxCount = ByteBufferPool.DEFAULT_MAX_COUNT;
    private long bufPoolTimeout = ByteBufferPool.DEFAULT_TIME_OUT_MILLIS;


    /**
     * 业务线程等待队列长度
     */
    private int bizQueueSize;


    /**
     * 停止服务时, 超时时间
     */
    private int closeTimeoutMills = 1000;

    public int getBizThreads() {
        return bizThreads;
    }

    public void setBizThreads(int bizThreads) {
        this.bizThreads = bizThreads;
    }

    public int getBizQueueSize() {
        return bizQueueSize;
    }

    public void setBizQueueSize(int bizQueueSize) {
        this.bizQueueSize = bizQueueSize;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMaxOutRequests() {
        return maxOutRequests;
    }

    public void setMaxOutRequests(int maxOutRequests) {
        this.maxOutRequests = maxOutRequests;
    }

    public int getMaxInRequests() {
        return maxInRequests;
    }

    public void setMaxInRequests(int maxInRequests) {
        this.maxInRequests = maxInRequests;
    }

    public long getMaxInBytes() {
        return maxInBytes;
    }

    public void setMaxInBytes(long maxInBytes) {
        this.maxInBytes = maxInBytes;
    }

    public int getSelectTimeoutMillis() {
        return selectTimeoutMillis;
    }

    public void setSelectTimeoutMillis(int selectTimeoutMillis) {
        this.selectTimeoutMillis = selectTimeoutMillis;
    }

    public int getCleanIntervalMills() {
        return cleanIntervalMills;
    }

    public void setCleanIntervalMills(int cleanIntervalMills) {
        this.cleanIntervalMills = cleanIntervalMills;
    }

    public int getCloseTimeoutMills() {
        return closeTimeoutMills;
    }

    public void setCloseTimeoutMills(int closeTimeoutMills) {
        this.closeTimeoutMills = closeTimeoutMills;
    }

    public int[] getBufPoolSize() {
        return bufPoolSize;
    }

    public int[] getBufPoolMinCount() {
        return bufPoolMinCount;
    }

    public int[] getBufPoolMaxCount() {
        return bufPoolMaxCount;
    }

    public long getBufPoolTimeout() {
        return bufPoolTimeout;
    }
}
